﻿using System;
using System.Collections.Generic;
using Com.FastSearch.SharePoint.Interfaces;

namespace ESPWebPartsUnitTest.mock
{
    class ESPNavigatorMock : IESPNavigator
    {
        public string Name
        {
            get;
            set;
        }

        public string DisplayName
        {
            get;
            set;
        }

        public string Unit
        {
            get;
            set;
        }

        public int HitsUsed
        {
            get;
            set;
        }

        public int ItemCount
        {
            get;
            set;
        }

        public IEnumerable<IESPNavigatorItem> NavigatorItems
        {
            get;
            set;
        }

        public IEnumerable<IESPNavigatorItem> AppliedNavigatorItems
        {
            get;
            set;
        }
    }

    class ESPNavigatorItemMock : IESPNavigatorItem
    {
        public string FieldName
        {
            get;
            set;
        }

        public string FilterValue
        {
            get;
            set;
        }

        public string DisplayValue
        {
            get;
            set;
        }

        public int ResultCount
        {
            get;
            set;
        }

        public string GetNavigationParam(string scope, char split)
        {
            throw new NotImplementedException();
        }

        public override bool Equals(object o)
        {
            if (!(o is IESPNavigatorItem))
            {
                return false;
            }
            IESPNavigatorItem item = (IESPNavigatorItem)o;
            return FieldName == item.FieldName &&
                   FilterValue == item.FilterValue &&
                   DisplayValue == item.DisplayValue;
        }

        public override int GetHashCode()
        {
            return FieldName.GetHashCode() +
                   13 * FilterValue.GetHashCode() +
                   27 * DisplayValue.GetHashCode();
        }
    }
}
